package com.fifth.user.controller.api;

import com.fifth.common.pojo.dto.CommonResult;
import com.fifth.common.pojo.entity.Collection;
import com.fifth.user.service.CollectionService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/user/collection")
public class ApiCollection {
    @Autowired
    private CollectionService collectionService;

    @PostMapping("isGoodsCollection/{goodsid}/{uid}")
    public Collection isGoodsCollection(@PathVariable String goodsid,@PathVariable String uid){
        return collectionService.isGoodsCollection(goodsid,uid);
    }
    @PostMapping("insertCollection/{goodsid}/{uid}")
    public CommonResult insertConllection(@PathVariable String goodsid,@PathVariable String uid){
        return collectionService.insertGid(goodsid,uid);
    }
    //删除收藏商品信息
    @PostMapping("deleteGid/{goodsid}/{uid}")
    public CommonResult deleteCollection(@PathVariable String goodsid,@PathVariable String uid){
        return collectionService.deleteGid(goodsid,uid);
    }
    //添加关注店铺信息
    @PostMapping("insertBid/{bid}/{uid}")
    public CommonResult insertBid(@PathVariable String bid,@PathVariable String uid){
        return collectionService.insertBid(bid,uid);
    }
    //删除关注店铺信息
    @PostMapping("deleteByBid/{bid}/{uid}")
    public CommonResult deleteByBid(@PathVariable String bid,@PathVariable String uid){
        return collectionService.deleteByBid(bid,uid);
    }
    //根据bid和uid查询当前行是否存在
    @PostMapping("selectBidAUid/{bid}/{uid}")
    public Collection selectBidAUid(@PathVariable String bid,@PathVariable String uid){
        return collectionService.selectBidAUid(bid,uid);
    }

}
